import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JButton;
import java.awt.BorderLayout;
import java.awt.Frame;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Window;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Insets;
import net.miginfocom.swing.MigLayout;



public class ApplicationGUI {

	private JFrame frmApplication;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					ApplicationGUI window = new ApplicationGUI();
					window.frmApplication.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the application.
	 */
	public ApplicationGUI() {
		initialize();
	}
	


	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frmApplication = new JFrame();
		frmApplication.setTitle("Application");
		frmApplication.setBounds(100, 100, 450, 300);
		frmApplication.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frmApplication.getContentPane().setLayout(new MigLayout("", "[57px][][][][][][]", "[23px][][][][][][][][][][][][][][][][]"));
		
		frmApplication.setVisible(true);
		
		JButton btnLogin = new JButton("Login");
		btnLogin.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				frmApplication.setVisible(false);
				LoginNew registration = new LoginNew(frmApplication);
				registration.setVisible(true);
				
			}
		});
		frmApplication.getContentPane().add(btnLogin, "cell 0 0,growx,aligny bottom");
		
		JButton btnLogout = new JButton("Logout");
		btnLogout.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				//TODO: return to main menu.
			}
		});
		frmApplication.getContentPane().add(btnLogout, "cell 0 1,growx");
		
		JButton btnBuyTicket = new JButton("Buy Ticket");
		frmApplication.getContentPane().add(btnBuyTicket, "cell 5 2,growx,aligny center");
		
		JButton btnCancelTicket = new JButton("Cancel Ticket");
		frmApplication.getContentPane().add(btnCancelTicket, "cell 5 4,growx");
		
		JButton btnRidesCatalog = new JButton("Rides Catalog");
		frmApplication.getContentPane().add(btnRidesCatalog, "cell 5 6,growx");
		
		JButton btnChildsETicket = new JButton("Child's E-Ticket");
		frmApplication.getContentPane().add(btnChildsETicket, "cell 5 8");
		
		JButton btnMainMenu = new JButton("Main Menu");
		btnMainMenu.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				frmApplication.setVisible(false);
				MainMenu mainMenu = new MainMenu();
				mainMenu.setVisible(true);
			}
		});
		frmApplication.getContentPane().add(btnMainMenu, "cell 0 13,growx");
	}

}
